package com.gzr.demo01.threadestate;

import java.text.SimpleDateFormat;
import java.util.Date;

//打印时间
public class TestSleep2 {

    public static void main(String[] args) throws InterruptedException {
        Date stareTime = new Date(System.currentTimeMillis());//获取系统当前时间
        while (true) {
            Thread.sleep(1000);
            System.out.println(new SimpleDateFormat("HH:mm:ss").format(stareTime));
            stareTime = new Date(System.currentTimeMillis());
        }
    }
}
